package com.rd.student.jiaji.class4.suyan.zrrd.Homework3;

import java.util.Arrays;
import java.util.Random;

public class ArraysUtils {
    /*public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
        int max = 0;
        int max1=0;
        int min=0;
        int min1=0;
        int[] arr1 = new int[10];
        Random random = new Random();
        int b = random.nextInt(35);
        int s=random.nextInt(20);


        for (int i = 0; i < arr1.length; i++) {
            if (arr1[i] > arr1[max1]) {
                max1 = i;
            }
        }
        for (int a = 0; a < arr.length; a++) {
            arr1[a]=b;
            if (arr[a] > arr[max]) {
                max = a;
            }

        }
        for (int i=0;i<arr.length;i++) {
            if (arr[i] < arr[min]) {
                min = i;
            }
        }
        for (int a=0;a<arr1.length;a++) {
            arr1[a]=s;
            if (arr1[a] < arr1[min1]) {
                min1 = a;
            }
        }
        System.out.println(arr[max]);

        System.out.println(Arrays.toString(arr1));
        System.out.println(arr1[max1]);
            System.out.println(arr[min]);
        System.out.println(arr1[min1]);

     */
    public void max(int arr[]){
        int max=arr[0];
        for (int i=0;i<arr.length;i++){
            if (arr[i]>max){
                max=i;
            }
        }
        System.out.println("最大值"+max);
    }
    public  void min(int arr[]){
        int min=arr[0];
        for (int i=0;i<arr.length;i++){
            if (arr[i]<min){
                min=i;
            }
        }
        System.out.println("最小值"+min);
    }
    public void reciprocal(){
        int[] arr={1,2,3,4,5};
        for (int i=0,j=arr.length-1;i<=j;i++,j--){
            int temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;
            if (i>j){
                break;
            }
        }
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }

        }
        public void  dilatancy(){
        int[] a={1,2,3};
        int[] b= Arrays.copyOf(a,6);
            System.out.println(Arrays.toString(a));
            System.out.println(Arrays.toString(b));
        }
    }


